-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support (logical) name for resources and config variables #546
Conversation
b6fb766
to
3503088
Compare
Why do we even support __logicalName on outputs in PCL? I don't think any language supports referencing of outputs, this looks like something we should clean up. |
My first thought was maybe block labels couldn't be arbitary strings, and that's true for the first label but that's always going to be "output". The second block label is fine to be a string literal: https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#structural-elements We should sanitize this. |
469a7a1
to
1f17b1b
Compare
Indeed 💯 |
0cbacc5
to
b7f833c
Compare
Prompted by pulumi/pulumi-yaml#546 At some point we added `__logicalName` to outputs to match resources/config. But outputs don't actually need lexical and logical names, they only have logical names. In the cases where `__logicalName` was set the lexical name was totally ignored. We can simply just use the block label (block labels can be arbitrary strings) and eventually deprecate the `__logicalName` option on `output`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM great work for getting this done so quickly, will really help unblock providers. Glad it wasn't too gnarly.
Upgrade pulumi-yaml to the latest version, which includes pulumi/pulumi-yaml#546
Upgrade pulumi-yaml to the latest version, which includes pulumi/pulumi-yaml#546
@Frassle outputs have logical names because they can have names that are not legal identifiers using the |
Yeh we worked that out, but outputs only have one name. Unlike resources which have a source name and a logical name outputs just have a logical name. See pulumi/pulumi#15180 for the follow up on this. |
Description
Fixes #539, #477
This PR adds support for resources and config variables to have a logical name other than their lexical name which is used to reference the resources or variables in the YAML program.
Added as a top-level field:
Where the
bucket
is the lexical name that is used for the program evaluator andmy-bucket
is the name that is used when registering the resource. In TypeScript it would look like this:Similarly, configuration variables can now have a logical name as well where at runtime, it will be the key used to query the config data provided by Pulumi CLI whereas their lexical name is just how they are defined and referenced in the program.
Program-gen for YAML has been updated. Take this PCL:
Becomes: